home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / nn.zip / DATA.H < prev    next >
C/C++ Source or Header  |  1989-12-31  |  5KB  |  160 lines

  1. /*
  2.  *    Internal representation of the master, group, and article
  3.  *    information read from the database.
  4.  *
  5.  *    For each article read from the database, an article_header
  6.  *    structure is initialized.
  7.  */
  8.  
  9. /*
  10.  *    global master data
  11.  */
  12.  
  13. typedef struct {
  14.     time_t        last_scan; /* age of active file at last scan */
  15.     group_number    number_of_groups;
  16.     off_t        next_group_write_offset; /* in .groups */
  17.     int            free_groups; /* allocated during first visit */
  18. } master_header;
  19.  
  20. /*
  21.  *    group information
  22.  */
  23.  
  24. typedef struct group_header {
  25.  
  26.     /* this part of the header is read from */
  27.     /* the .master file                */
  28.  
  29.     article_number    first_l_article;
  30.     article_number    last_l_article;
  31.  
  32.     off_t        index_write_offset;
  33.     off_t        data_write_offset;
  34.  
  35.     int            group_name_length;
  36.  
  37.     int32        group_flag;
  38.  
  39. #ifdef I286_BUG
  40. #    define MF(n)    (1L<<(n-1))
  41. #    define CF(n)    (1L<<(n+15))
  42. #else
  43. #    define MF(n)    (((int32)1)<<(n-1))
  44. #    define CF(n)    (((int32)1)<<(n+15))
  45. #endif
  46.  
  47. #    define G_MASTER_FLAGS    (MF(17)-1) /* flags that are saved on file */
  48.  
  49.     /* master flags */
  50.  
  51.  
  52. #    define G_MODERATED    MF(1)    /* group is moderated */
  53. #    define G_CONTROL    MF(2)    /* group is control group */
  54. #    define G_NO_DIRECTORY    MF(3)    /* group directory not found */
  55. #    define G_ALWAYS_DIGEST    MF(4)    /* always decode articles as digests */
  56. #    define G_NEVER_DIGEST    MF(5)    /* never decode articles as digests */
  57. #    define G_EXPIRE        MF(6)    /* expire in progress or pending */
  58. #    define G_BLOCKED    MF(7)    /* don't trust this entry */
  59.  
  60.     /* client flags */
  61.  
  62. #    define G_SUBSCRIPTION    CF(1)    /* from .rc */
  63. #    define G_READ        CF(2)    /* group has been read    */
  64. #    define G_DONE        CF(4)    /* finished with this group */
  65. #    define G_NEW        CF(5)    /* new group */
  66. #    define G_FOLDER        CF(6)    /* "group" is a folder file */
  67. #    define G_DIRECTORY    CF(7)    /* "group" is directory */
  68. #    define G_SELECTION    CF(8)    /* a selection exist (use it) */
  69. #    define G_UNREAD_COUNT    CF(9)    /* is included in unread_articles */
  70. #    define G_MAILBOX    CF(10)    /* user's mail box file */
  71.  
  72.     /* this part is initialized during reading of the .groups file */
  73.  
  74.     /* DO NOT CHANGE THE POSITION OF group_num AS THE FIRST FIELD */
  75.     /* AFTER THE PART WHICH IS SAVED IN THE MASTER FILE */
  76.  
  77.     group_number    group_num;
  78.     group_number    preseq_index;
  79.  
  80.     char *        group_name;
  81.     
  82.     /* this part is used by the master to hold active file data */
  83.     /* and the reader to hold information from the .rc file */
  84.  
  85.     article_number    first_article;
  86.     article_number    last_article;
  87.  
  88.     struct group_header *next_group;    /* group sequence */
  89.     struct group_header    *prev_group;
  90.  
  91.     char        *kill_list;
  92.     char        *save_file;     /* default save file from init */
  93.     char        *enter_macro;
  94.     
  95.     off_t        rc_offset;    /* offset in rc_file */
  96. } group_header;
  97.  
  98.  
  99. /* size of the part of the group header placed on backing storage */
  100.  
  101.  
  102. #define SAVED_GROUP_HEADER_SIZE(group) \
  103.     (((char *)(&((group).group_num))) - ((char *)(&(group))))
  104.  
  105. /*
  106.  *    Internal article header information.
  107.  */
  108.  
  109. typedef struct {
  110.     union {
  111.     article_number au_number;    /* article number in the group    */
  112.     char *au_string;
  113.     } au_union;
  114.                 /* indexes to header line text    */
  115.     off_t    hpos;        /* first byte of header        */
  116.     off_t    fpos;        /* first byte in article text    */
  117.     off_t    lpos;        /* last pos of article        */
  118.  
  119.     time_stamp     t_stamp;    /* encoded time_stamp        */
  120.     
  121.     char *    sender;        /*   sender's name        */
  122.     char *    subject;    /*   subject (w/o Re:)        */
  123.  
  124.     int16    replies;    /*   no of Re:            */
  125.     int16    lines;        /*   no of lines        */
  126.  
  127.     int8    subj_length;    /*   length of subject        */
  128.     int8    name_length;    /*   length of sender        */
  129.     
  130.     group_header *a_group;    /* if merged article menu    */
  131.     
  132.     int32    flag;        /* flags:             */
  133.  
  134. #    define AF(n) (((int32)1)<<(n-1))
  135.  
  136. #    define A_SELECT       AF(1)    /* article has been selected    */
  137. #    define A_SAME            AF(2)    /* same subject as prev. article */
  138. #    define A_DIGEST       AF(3)    /* digest sub article        */
  139. #    define A_FULL_DIGEST    AF(4)    /* full digest            */
  140. #    define A_FAKED        AF(5)    /* only 'number' is valid    */
  141. #    define A_FOLDER        AF(6)    /* article file = "folder_path"    */
  142. #    define A_CANCEL        AF(7)    /* folder entry cancelled    */
  143. #    define A_SEEN        AF(8)    /* article presented on menu    */
  144. #    define A_KILL        AF(9)    /* eliminate article        */
  145. #    define A_AUTO        AF(10)    /* article was auto selected    */
  146. #    define A_READ        AF(11)    /* article has been read    */
  147. #    define A_LEAVE        AF(12)    /* marked for later activity    */
  148. #    define A_LEAVE_NEXT    AF(13)    /* marked for next invokation    */
  149.  
  150. #    define A_ST_FILED    AF(16)    /* articles is saved        */
  151. #    define A_ST_REPLY    AF(17)    /* sent reply to article    */
  152. #    define A_ST_FOLLOW    AF(18)    /* sent followup to article    */
  153.  
  154. } article_header;
  155.  
  156.  
  157. #define    a_number    au_union.au_number
  158. #define a_string    au_union.au_string
  159.  
  160.